import { RouterModule, Routes } from '@angular/router'

import { WorkspaceComponent } from './workspace.component'
import { SplashComponent } from './splash/splash.component'

const appRoutes: Routes = [
  {
    path: '',
    component: WorkspaceComponent,
    children: [
      {
        path: '',
        redirectTo: 'splash',
        pathMatch: 'full'
      },
      {
        path: 'splash',
        component: SplashComponent,
        data: {
          title: '房乐美',
          depth: 1
        }
      },
      {
        path: 'home',
        loadChildren: './home/home.module#HomeModule',
        data: {
          title: '房乐美',
          depth: 1
        }
      },
      {
        path: 'discover',
        loadChildren: './discover/discover.module#DiscoverModule',
        data: {
          title: '发现',
          depth: 1
        }
      },
      {
        path: 'follow',
        loadChildren: './follow/follow.module#FollowModule',
        data: {
          title: '关注',
          depth: 1
        }
      },
      {
        path: 'mine',
        loadChildren: './mine/mine.module#MineModule',
        data: {
          title: '我的',
          depth: 1
        }
      },
      {
        path: 'estate',
        loadChildren: './estate/estate.module#EstateModule',
        data: {
          title: '楼盘',
          depth: 2
        }
      }
    ]
  }
]

export const router = RouterModule.forChild(appRoutes)
